package day0726API;

import java.io.*;
import java.net.Socket;

public class S2_T  extends  Thread{

    Socket  s=null;
    S2_T(Socket  s){
        this.s=s;
    }

    public void run() {
        try{
            InputStream is=s.getInputStream();
            InputStreamReader isr=new InputStreamReader(is);
            BufferedReader br=new BufferedReader(isr);

            OutputStream os=s.getOutputStream();
            OutputStreamWriter osw=new OutputStreamWriter(os);
            PrintWriter pw=new PrintWriter(osw);

            while(true){
                String clientMsg=br.readLine();
                System.out.println(clientMsg);
                pw.println(clientMsg);
                pw.flush();
            }
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
